#ifndef COURSESELECTION_H
#define COURSESELECTION_H

#include <QDialog>
#include "course.h"


namespace Ui {
class CourseSelection;
}

class CourseSelection : public QDialog
{
    Q_OBJECT

public:
    explicit CourseSelection(QWidget *parent = nullptr);
    ~CourseSelection();
    void setCourseList(const QList<Course> courseList);


private slots:
    void on_courseTable_clicked(const QModelIndex &index);
    void on_selectAll_clicked();
    void on_unselectAll_clicked();
    void on_selectAll_bixiu_clicked();
    void on_unselectAll_gongxuan_clicked();
    void on_submit_clicked();

signals:
    void selectedCourseList(const QList<Course> courseList);     // 保存普通信息

private:
    void initTable();
    void appendOneRow(int id, QString name, QString sx, QString xz, double xf, int xs, QString time);
    void lineSpacing();

private:
    Ui::CourseSelection *ui;
    QList<Course>        courseList; // 课程列表
    QMap<int, int>       select;     // 选中标记
};

#endif // COURSESELECTION_H
